<!DOCTYPE html>

<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">

<title>class EventsController - Rails Application Documentation</title>

<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
</script>

<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>


<body id="top" class="class">
<nav id="metadata">
  <nav id="home-section" class="section">
  <h3 class="section-header">
    <a href="./index.html">Home</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </h3>
</nav>


  <nav id="search-section" class="section project-section" class="initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <h3 class="section-header">
      <input type="text" name="search" placeholder="Search" id="search-field"
             title="Type to search, Up and Down to navigate, Enter to load">
    </h3>
  </form>

  <ul id="search-results" class="initially-hidden"></ul>
</nav>


  <div id="file-metadata">
    <nav id="file-list-section" class="section">
  <h3 class="section-header">Defined In</h3>
  <ul>
    <li>app/controllers/events_controller.rb
  </ul>
</nav>

    
  </div>

  <div id="class-metadata">
    
    <nav id="parent-class-section" class="section">
  <h3 class="section-header">Parent</h3>
  
  <p class="link"><a href="ApplicationController.html">ApplicationController</a>
  
</nav>

    
    <!-- Method Quickref -->
<nav id="method-list-section" class="section">
  <h3 class="section-header">Methods</h3>

  <ul class="link-list">
    
    <li><a href="#method-i-checkAttendence">#checkAttendence</a>
    
    <li><a href="#method-i-create">#create</a>
    
    <li><a href="#method-i-destroy">#destroy</a>
    
    <li><a href="#method-i-edit">#edit</a>
    
    <li><a href="#method-i-index">#index</a>
    
    <li><a href="#method-i-invitePeople">#invitePeople</a>
    
    <li><a href="#method-i-locationInsert">#locationInsert</a>
    
    <li><a href="#method-i-new">#new</a>
    
    <li><a href="#method-i-show">#show</a>
    
    <li><a href="#method-i-update">#update</a>
    
  </ul>
</nav>

  </div>

  <div id="project-metadata">
    <nav id="fileindex-section" class="section project-section">
  <h3 class="section-header">Pages</h3>

  <ul>
  
    <li class="file"><a href="./doc/README_FOR_APP.html">README_FOR_APP</a>
  
  </ul>
</nav>

    <nav id="classindex-section" class="section project-section">
  <h3 class="section-header">Class and Module Index</h3>

  <ul class="link-list">
  
    <li><a href="./ApplicationController.html">ApplicationController</a>
  
    <li><a href="./ApplicationHelper.html">ApplicationHelper</a>
  
    <li><a href="./Comment.html">Comment</a>
  
    <li><a href="./CommentsController.html">CommentsController</a>
  
    <li><a href="./CommentsHelper.html">CommentsHelper</a>
  
    <li><a href="./Event.html">Event</a>
  
    <li><a href="./EventsController.html">EventsController</a>
  
    <li><a href="./EventsHelper.html">EventsHelper</a>
  
    <li><a href="./Group.html">Group</a>
  
    <li><a href="./HomeController.html">HomeController</a>
  
    <li><a href="./HomeHelper.html">HomeHelper</a>
  
    <li><a href="./InviteeList.html">InviteeList</a>
  
    <li><a href="./InviteeListsController.html">InviteeListsController</a>
  
    <li><a href="./InviteeListsHelper.html">InviteeListsHelper</a>
  
    <li><a href="./Location.html">Location</a>
  
    <li><a href="./LocationsController.html">LocationsController</a>
  
    <li><a href="./LocationsHelper.html">LocationsHelper</a>
  
    <li><a href="./Notification.html">Notification</a>
  
    <li><a href="./Organization.html">Organization</a>
  
    <li><a href="./Post.html">Post</a>
  
    <li><a href="./PostsController.html">PostsController</a>
  
    <li><a href="./PostsHelper.html">PostsHelper</a>
  
    <li><a href="./Response.html">Response</a>
  
    <li><a href="./ResponsesController.html">ResponsesController</a>
  
    <li><a href="./ResponsesHelper.html">ResponsesHelper</a>
  
    <li><a href="./User.html">User</a>
  
    <li><a href="./UsersController.html">UsersController</a>
  
    <li><a href="./UsersHelper.html">UsersHelper</a>
  
  </ul>
</nav>

  </div>
</nav>

<div id="documentation">
  <h1 class="class">class EventsController</h1>

  <div id="description" class="description">
    
  </div><!-- description -->

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    

    <!-- Methods -->
    
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
      <h3 class="section-header">Public Instance Methods</h3>

    
      <div id="method-i-checkAttendence" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">checkAttendence</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="checkAttendence-source">
            <pre><span class="ruby-comment"># File app/controllers/events_controller.rb, line 178</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">checkAttendence</span>
    <span class="ruby-identifier">success</span> = <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">post?</span>
        <span class="ruby-ivar">@array</span> = <span class="ruby-identifier">params</span>[<span class="ruby-value">:invitees</span>]
        <span class="ruby-identifier">eid</span> = <span class="ruby-identifier">params</span>[<span class="ruby-value">:eid</span>]
        <span class="ruby-ivar">@array</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">id</span><span class="ruby-operator">|</span>
            <span class="ruby-ivar">@invitee</span> = <span class="ruby-constant">InviteeList</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">:first</span>, <span class="ruby-value">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-string">&quot;user_ids = ? AND event_id = ?&quot;</span>,<span class="ruby-identifier">id</span>, <span class="ruby-identifier">eid</span>])                
            <span class="ruby-keyword">if</span> <span class="ruby-ivar">@invitee</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
                <span class="ruby-ivar">@invitee</span>.<span class="ruby-identifier">attended</span> = <span class="ruby-keyword">true</span>
                <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@invitee</span>.<span class="ruby-identifier">save</span>
                    <span class="ruby-identifier">success</span> = <span class="ruby-keyword">false</span>
                <span class="ruby-keyword">end</span>
            <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>    
        <span class="ruby-ivar">@invitees</span> = <span class="ruby-constant">InviteeList</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">:all</span>, <span class="ruby-value">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-string">&quot;event_id = ?&quot;</span>, <span class="ruby-identifier">eid</span>])  
        <span class="ruby-ivar">@invitees</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">inv</span><span class="ruby-operator">|</span>
            <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span>(<span class="ruby-ivar">@array</span>.<span class="ruby-identifier">key?</span> <span class="ruby-identifier">inv</span>.<span class="ruby-identifier">user_ids</span>.<span class="ruby-identifier">to_s</span>)
                <span class="ruby-identifier">inv</span>.<span class="ruby-identifier">attended</span> = <span class="ruby-keyword">false</span>
                <span class="ruby-identifier">inv</span>.<span class="ruby-identifier">save</span>
            <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">success</span>    
            <span class="ruby-identifier">flash</span>[<span class="ruby-value">:message</span>] = <span class="ruby-string">&quot;Attendence Update Successful&quot;</span>
            <span class="ruby-identifier">redirect_to</span> <span class="ruby-string">'/events/'</span><span class="ruby-operator">+</span><span class="ruby-identifier">eid</span>.<span class="ruby-identifier">to_s</span>
        <span class="ruby-keyword">else</span>
            <span class="ruby-identifier">flash</span>[<span class="ruby-value">:warning</span>] = <span class="ruby-string">&quot;Attendence Update Unsuccessful&quot;</span>
            <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">events_url</span>
        <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- checkAttendence-source -->
          
        </div>

        

        
      </div><!-- checkAttendence-method -->

    
      <div id="method-i-create" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>POST /events POST /events.json</p>
          

          
          <div class="method-source-code" id="create-source">
            <pre><span class="ruby-comment"># File app/controllers/events_controller.rb, line 47</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create</span>
  <span class="ruby-ivar">@event</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:event</span>])
  <span class="ruby-ivar">@event</span>.<span class="ruby-identifier">author_id</span> = <span class="ruby-identifier">session</span>[<span class="ruby-value">:user</span>].<span class="ruby-identifier">id</span>

  <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@event</span>.<span class="ruby-identifier">save</span>
      <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">redirect_to</span> <span class="ruby-string">'/event/location/?id='</span><span class="ruby-operator">+</span><span class="ruby-ivar">@event</span>.<span class="ruby-identifier">id</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-value">:notice</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Event was successfully created.'</span> }
      <span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:json</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@event</span>, <span class="ruby-value">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:created</span> }
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;new&quot;</span> }
      <span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:json</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@event</span>.<span class="ruby-identifier">errors</span>, <span class="ruby-value">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:unprocessable_entity</span> }
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- create-source -->
          
        </div>

        

        
      </div><!-- create-method -->

    
      <div id="method-i-destroy" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">destroy</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>DELETE /events/1 DELETE /events/1.json</p>
          

          
          <div class="method-source-code" id="destroy-source">
            <pre><span class="ruby-comment"># File app/controllers/events_controller.rb, line 80</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">destroy</span>
  <span class="ruby-ivar">@event</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
  <span class="ruby-ivar">@event</span>.<span class="ruby-identifier">destroy</span>

  <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">events_url</span> }
    <span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">head</span> <span class="ruby-value">:no_content</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- destroy-source -->
          
        </div>

        

        
      </div><!-- destroy-method -->

    
      <div id="method-i-edit" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">edit</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>GET /events/1/edit</p>
          

          
          <div class="method-source-code" id="edit-source">
            <pre><span class="ruby-comment"># File app/controllers/events_controller.rb, line 41</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">edit</span>
  <span class="ruby-ivar">@event</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
<span class="ruby-keyword">end</span></pre>
          </div><!-- edit-source -->
          
        </div>

        

        
      </div><!-- edit-method -->

    
      <div id="method-i-index" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">index</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>GET /events GET /events.json</p>
          

          
          <div class="method-source-code" id="index-source">
            <pre><span class="ruby-comment"># File app/controllers/events_controller.rb, line 9</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">index</span>
  <span class="ruby-ivar">@events</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">all</span>

  <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> <span class="ruby-comment"># index.html.erb</span>
    <span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:json</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@events</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- index-source -->
          
        </div>

        

        
      </div><!-- index-method -->

    
      <div id="method-i-invitePeople" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">invitePeople</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="invitePeople-source">
            <pre><span class="ruby-comment"># File app/controllers/events_controller.rb, line 160</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">invitePeople</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">post?</span>
        <span class="ruby-ivar">@array</span> = <span class="ruby-identifier">params</span>[<span class="ruby-value">:invitees</span>]
        <span class="ruby-identifier">url</span> = <span class="ruby-identifier">params</span>[<span class="ruby-value">:url</span>]
        <span class="ruby-identifier">url_params</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">parse_query</span> <span class="ruby-constant">URI</span>(<span class="ruby-identifier">url</span>).<span class="ruby-identifier">query</span>
        <span class="ruby-identifier">eid</span> = <span class="ruby-identifier">url_params</span>[<span class="ruby-string">'id'</span>].<span class="ruby-identifier">to_i</span>
        <span class="ruby-ivar">@array</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">id</span><span class="ruby-operator">|</span>
            <span class="ruby-ivar">@inviteeList</span> = <span class="ruby-constant">InviteeList</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:user_ids</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">id</span>, <span class="ruby-value">:event_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">eid</span>)
            <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@inviteeList</span>.<span class="ruby-identifier">save</span>
                <span class="ruby-identifier">flash</span>[<span class="ruby-value">:warning</span>] = <span class="ruby-string">&quot;Inviting unsuccessful&quot;</span>
                <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">invite_url</span>
            <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-identifier">flash</span>[<span class="ruby-value">:message</span>] = <span class="ruby-string">&quot;Inviting successful&quot;</span>
        <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">events_path</span>
    <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- invitePeople-source -->
          
        </div>

        

        
      </div><!-- invitePeople-method -->

    
      <div id="method-i-locationInsert" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">locationInsert</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="locationInsert-source">
            <pre><span class="ruby-comment"># File app/controllers/events_controller.rb, line 101</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">locationInsert</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">post?</span>
                <span class="ruby-ivar">@location</span> = <span class="ruby-constant">Location</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:location</span>])
                <span class="ruby-identifier">url</span> = <span class="ruby-identifier">params</span>[<span class="ruby-value">:url</span>]
    <span class="ruby-identifier">url_params</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">parse_query</span> <span class="ruby-constant">URI</span>(<span class="ruby-identifier">url</span>).<span class="ruby-identifier">query</span>
    <span class="ruby-identifier">eid</span> = <span class="ruby-identifier">url_params</span>[<span class="ruby-string">'id'</span>]
                <span class="ruby-ivar">@location</span>.<span class="ruby-identifier">event_id</span>=<span class="ruby-identifier">eid</span>.<span class="ruby-identifier">to_i</span>
                <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
                <span class="ruby-identifier">l</span> = <span class="ruby-ivar">@location</span>
                
                <span class="ruby-identifier">params</span>=<span class="ruby-constant">String</span>.<span class="ruby-identifier">new</span><span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-ivar">@location</span>.<span class="ruby-identifier">addressName</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">?</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">:</span><span class="ruby-node">&quot;#{@location.addressName},&quot;</span>)
                <span class="ruby-identifier">params</span> = <span class="ruby-identifier">params</span><span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-ivar">@location</span>.<span class="ruby-identifier">addressLn1</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">?</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">:</span><span class="ruby-node">&quot;#{@location.addressLn1},&quot;</span>)
                <span class="ruby-identifier">params</span> = <span class="ruby-identifier">params</span><span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-ivar">@location</span>.<span class="ruby-identifier">addressLn2</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">?</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">:</span><span class="ruby-node">&quot;#{@location.addressLn2},&quot;</span>)<span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-ivar">@location</span>.<span class="ruby-identifier">city</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">?</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">:</span><span class="ruby-node">&quot;#{@location.city},&quot;</span>)
                <span class="ruby-identifier">params</span> = <span class="ruby-identifier">params</span><span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-ivar">@location</span>.<span class="ruby-identifier">stateCode</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">?</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">:</span><span class="ruby-node">&quot;#{@location.stateCode},&quot;</span>)<span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-ivar">@location</span>.<span class="ruby-identifier">zipCode</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">?</span> <span class="ruby-string">&quot;&quot;</span><span class="ruby-operator">:</span><span class="ruby-node">&quot;#{@location.zipCode},&quot;</span>)
                <span class="ruby-identifier">params</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">chop</span>
                
                
                <span class="ruby-identifier">address</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&quot; &quot;</span>,<span class="ruby-string">&quot;+&quot;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&quot;|&quot;</span>,<span class="ruby-string">&quot;%7C&quot;</span>)
                
                
                <span class="ruby-identifier">geocoderURI</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;http://maps.googleapis.com/maps/api/geocode/xml?address=&quot;</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-identifier">address</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-string">&quot;&amp;sensor=false&quot;</span>)
                <span class="ruby-identifier">http</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">geocoderURI</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">geocoderURI</span>.<span class="ruby-identifier">port</span>)
                <span class="ruby-identifier">request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Get</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">geocoderURI</span>.<span class="ruby-identifier">request_uri</span>)
                <span class="ruby-identifier">response</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">request</span>)                     
                <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">!=</span> <span class="ruby-string">&quot;200&quot;</span>
                        <span class="ruby-identifier">redirect_to</span> <span class="ruby-string">'/event/location/?id='</span><span class="ruby-operator">+</span><span class="ruby-identifier">eid</span>, <span class="ruby-value">:notice</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;Connection Error, responce.code=&quot;</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span>
                        <span class="ruby-keyword">return</span>
                <span class="ruby-keyword">end</span>
                <span class="ruby-identifier">xml_data</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>;
                <span class="ruby-identifier">data</span> = <span class="ruby-constant">XmlSimple</span>.<span class="ruby-identifier">xml_in</span>(<span class="ruby-identifier">xml_data</span>, { <span class="ruby-string">'KeyAttr'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'name'</span> })
                <span class="ruby-keyword">if</span> <span class="ruby-identifier">data</span>[<span class="ruby-string">'status'</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">%r\[|\]|&quot;/</span>, <span class="ruby-string">''</span>)   <span class="ruby-operator">==</span> <span class="ruby-string">&quot;ZERO_RESULTS&quot;</span>
                        <span class="ruby-identifier">redirect_to</span> <span class="ruby-string">'/event/location/?id='</span><span class="ruby-operator">+</span><span class="ruby-identifier">eid</span>, <span class="ruby-value">:notice</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Could not find location, try again.'</span>
                        <span class="ruby-keyword">return</span>
                <span class="ruby-keyword">end</span>
                
                <span class="ruby-identifier">lat</span> = <span class="ruby-identifier">data</span>[<span class="ruby-string">'result'</span>][<span class="ruby-value">0</span>][<span class="ruby-string">'geometry'</span>][<span class="ruby-value">0</span>][<span class="ruby-string">'location'</span>][<span class="ruby-value">0</span>][<span class="ruby-string">'lat'</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">%r\[|\]|&quot;/</span>, <span class="ruby-string">''</span>)
                <span class="ruby-identifier">lon</span> = <span class="ruby-identifier">data</span>[<span class="ruby-string">'result'</span>][<span class="ruby-value">0</span>][<span class="ruby-string">'geometry'</span>][<span class="ruby-value">0</span>][<span class="ruby-string">'location'</span>][<span class="ruby-value">0</span>][<span class="ruby-string">'lng'</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">%r\[|\]|&quot;/</span>, <span class="ruby-string">''</span>)
                <span class="ruby-identifier">mapWt</span> = <span class="ruby-string">&quot;500&quot;</span>
                <span class="ruby-identifier">mapHt</span> = <span class="ruby-string">&quot;400&quot;</span>
                <span class="ruby-identifier">mapImgSrc</span> = <span class="ruby-string">&quot;http://maps.googleapis.com/maps/api/staticmap?&quot;</span><span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;markers=color:blue|label:&quot;</span>
                <span class="ruby-identifier">mapImgSrc</span> = <span class="ruby-identifier">mapImgSrc</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-ivar">@location</span>.<span class="ruby-identifier">locationName</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&quot; &quot;</span>,<span class="ruby-string">&quot;+&quot;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&quot;|&quot;</span>,<span class="ruby-string">&quot;%7c&quot;</span>)<span class="ruby-operator">&lt;&lt;</span><span class="ruby-string">&quot;|&quot;</span> 
                <span class="ruby-identifier">mapImgSrc</span> = <span class="ruby-identifier">mapImgSrc</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-identifier">lat</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-string">&quot;,&quot;</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-identifier">lon</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-string">&quot;&amp;zoom=14&amp;size=&quot;</span> 
                <span class="ruby-identifier">mapImgSrc</span> = <span class="ruby-identifier">mapImgSrc</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-identifier">mapWt</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-string">&quot;x&quot;</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-identifier">mapHt</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-string">&quot;&amp;sensor=false&quot;</span>
                <span class="ruby-identifier">mapImgSrc</span> = <span class="ruby-identifier">mapImgSrc</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&quot; &quot;</span>,<span class="ruby-string">&quot;+&quot;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&quot;|&quot;</span>,<span class="ruby-string">&quot;%7c&quot;</span>)
                <span class="ruby-ivar">@location</span>.<span class="ruby-identifier">gmapString</span> = <span class="ruby-identifier">mapImgSrc</span>
                
                
                        <span class="ruby-keyword">if</span> <span class="ruby-ivar">@location</span>.<span class="ruby-identifier">save</span>

        <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">redirect_to</span> <span class="ruby-string">&quot;/event/invite/?id=&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">eid</span>, <span class="ruby-value">:notice</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Location was successfully created.'</span> }
                                <span class="ruby-keyword">else</span>
                                        <span class="ruby-identifier">print</span> <span class="ruby-string">&quot;\n\n\n\nfailed\n\n\n\n&quot;</span> 
                                        <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">redirect_to</span> <span class="ruby-string">'/event/location/?id='</span><span class="ruby-operator">+</span><span class="ruby-identifier">eid</span>, <span class="ruby-value">:notice</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;Failed to save location&quot;</span>}
            <span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:json</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@location</span>.<span class="ruby-identifier">errors</span>, <span class="ruby-value">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:unprocessable_entity</span> }
                        <span class="ruby-keyword">end</span>
                <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>   
<span class="ruby-keyword">end</span></pre>
          </div><!-- locationInsert-source -->
          
        </div>

        

        
      </div><!-- locationInsert-method -->

    
      <div id="method-i-new" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>GET /events/new GET /events/new.json</p>
          

          
          <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File app/controllers/events_controller.rb, line 31</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@event</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">new</span>

  <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> <span class="ruby-comment"># new.html.erb</span>
    <span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:json</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@event</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- new-source -->
          
        </div>

        

        
      </div><!-- new-method -->

    
      <div id="method-i-show" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">show</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>GET /events/1 GET /events/1.json</p>
          

          
          <div class="method-source-code" id="show-source">
            <pre><span class="ruby-comment"># File app/controllers/events_controller.rb, line 20</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">show</span>
  <span class="ruby-ivar">@event</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
      
  <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> <span class="ruby-comment"># show.html.erb</span>
    <span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:json</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@event</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- show-source -->
          
        </div>

        

        
      </div><!-- show-method -->

    
      <div id="method-i-update" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">update</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>PUT /events/1 PUT /events/1.json</p>
          

          
          <div class="method-source-code" id="update-source">
            <pre><span class="ruby-comment"># File app/controllers/events_controller.rb, line 64</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update</span>
  <span class="ruby-ivar">@event</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])

  <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@event</span>.<span class="ruby-identifier">update_attributes</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:event</span>])
      <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">redirect_to</span> <span class="ruby-ivar">@event</span>, <span class="ruby-value">:notice</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Event was successfully updated.'</span> }
      <span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">head</span> <span class="ruby-value">:no_content</span> }
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;edit&quot;</span> }
      <span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:json</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@event</span>.<span class="ruby-identifier">errors</span>, <span class="ruby-value">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:unprocessable_entity</span> }
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- update-source -->
          
        </div>

        

        
      </div><!-- update-method -->

    
    </section><!-- public-instance-method-details -->
  
  </section><!-- 5Buntitled-5D -->

</div><!-- documentation -->


<footer id="validator-badges">
  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>

